package com.ironman.h6b1gw.listener;

import lombok.extern.slf4j.Slf4j;
import org.dromara.mica.mqtt.core.client.IMqttClientConnectListener;
import org.springframework.stereotype.Component;
import org.tio.core.ChannelContext;

@Slf4j
@Component
public class MqttClientConnectListener implements IMqttClientConnectListener {

    @Override
    public void onConnected(ChannelContext context, boolean isReconnect) {
        log.info("onConnected {}", isReconnect ? "重连成功" : "首次连接成功");
    }

    @Override
    public void onDisconnect(ChannelContext context, Throwable throwable, String remark, boolean isRemove) {
        log.warn("onDisconnect remark:{} isRemove:{}", remark, isRemove);
    }
}
